package pe.com.certicom.moviles.model.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import pe.com.certicom.moviles.model.beans.Movimiento;
import pe.com.certicom.moviles.model.beans.MovimientoExample;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class MovimientoDAOImpl extends SqlMapClientDaoSupport implements MovimientoDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public MovimientoDAOImpl() {
        super();
    }
    
	@Autowired
	public void createSqlMapClient(SqlMapClient sqlMapClient){
	   setSqlMapClient(sqlMapClient);
	}

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int countByExample(MovimientoExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("movimiento.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int deleteByExample(MovimientoExample example) {
        int rows = getSqlMapClientTemplate().delete("movimiento.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int deleteByPrimaryKey(Long idMovimiento) {
        Movimiento key = new Movimiento();
        key.setIdMovimiento(idMovimiento);
        int rows = getSqlMapClientTemplate().delete("movimiento.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public void insert(Movimiento record) {
        getSqlMapClientTemplate().insert("movimiento.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public void insertSelective(Movimiento record) {
        getSqlMapClientTemplate().insert("movimiento.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    @SuppressWarnings("unchecked")
    public List<Movimiento> selectByExample(MovimientoExample example) {
        List<Movimiento> list = getSqlMapClientTemplate().queryForList("movimiento.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public Movimiento selectByPrimaryKey(Long idMovimiento) {
        Movimiento key = new Movimiento();
        key.setIdMovimiento(idMovimiento);
        Movimiento record = (Movimiento) getSqlMapClientTemplate().queryForObject("movimiento.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int updateByExampleSelective(Movimiento record, MovimientoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("movimiento.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int updateByExample(Movimiento record, MovimientoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("movimiento.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int updateByPrimaryKeySelective(Movimiento record) {
        int rows = getSqlMapClientTemplate().update("movimiento.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    public int updateByPrimaryKey(Movimiento record) {
        int rows = getSqlMapClientTemplate().update("movimiento.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table movimiento
     *
     * @ibatorgenerated Thu May 09 00:32:06 COT 2013
     */
    private static class UpdateByExampleParms extends MovimientoExample {
        private Object record;

        public UpdateByExampleParms(Object record, MovimientoExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
    

	@Override
	public List<Movimiento> listarMovimientos(Map<String, Object> parametros) {
		List<Movimiento> list = getSqlMapClientTemplate().queryForList("movimiento.listarMovimientos", parametros);
        return list;
	}
}